var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var UI_JiXuGame_UIBindings = require("AA_UI_JiXuGame_UIBindings");
var UIView = require("AA_UIView");
var GameDataManager = require("AA_GameDataManager");
var BuffMag = require("AA_BuffMag");
var EventManager = require("AA_EventManager");
var EvenType = require("AA_EvenType");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_JiXuGame = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.nowcode = 1;
    t.auto_ui = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype._show = function (e) {
    var t = [];
    for (var o = 1; o < arguments.length; o++) {
      t[o - 1] = arguments[o];
    }
    this.nowcode = e;
    if (2 == e) {
      this.auto_ui.txt_desclb.string = "你的挑战模式还有未完成";
    } else {
      var n = GameDataManager.GameDataMgr.getJiXuGame();
      this.auto_ui.txt_desclb.string = "你在第" + n.level + "关还有未完成的战斗";
    }
  };
  _creator.prototype.onEnable = function () {};
  _creator.prototype._clickListener = function (e) {
    switch (e) {
      case this.auto_ui.btn_closeBtn:
        this._close();
        this.openGame(1);
        break;
      case this.auto_ui.btn_queDingBtn:
        this._close();
        this.openGame(2);
        break;
      case this.auto_ui.btn_quxiaoBtn:
        this._close();
        this.openGame(1);
    }
  };
  _creator.prototype.openGame = function (e) {
    var t = GameDataManager.GameDataMgr.getJiXuGame();
    if (1 == e) {
      GameDataManager.GameDataMgr.ClearGameBagData();
      if (1 == this.nowcode) {
        GameDataManager.GameDataMgr.updateCiTiao(t.level, null);
      } else {
        GameDataManager.GameDataMgr.updateTiaoZhanJiXu(1, false);
      }
    }
    if (2 == e) {
      if (1 == this.nowcode) {
        BuffMag.BuffMgr.setSaveCiTiao(t.citiaodata);
        EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Hall_StartGame, t.level, true);
      } else {
        EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.GAME_TIAOZHAN_VIEW, 1, true);
      }
    }
  };
  __decorate([_property(UI_JiXuGame_UIBindings.default)], _creator.prototype, "auto_ui", undefined);
  return __decorate([_ccclass], _creator);
}(UIView.default);
exports.default = _def_UI_JiXuGame;